Optimal. Leaf size=130 \[ \frac {2 \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a^2 d}-\frac {2 \sec (c+d x)}{a^2 d}-\frac {2 \sec ^3(c+d x)}{3 a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}+\frac {4 \tan (c+d x)}{a^2 d}+\frac {5 \tan ^3(c+d x)}{3 a^2 d}+\frac {2 \tan ^5(c+d x)}{5 a^2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.21, antiderivative size = 130, normalized size of antiderivative = 1.00, number of steps
used = 12, number of rules used = 8, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.276, Rules used = {2954, 2952,
3852, 2702, 308, 213, 2700, 276} \begin {gather*} \frac {2 \tan ^5(c+d x)}{5 a^2 d}+\frac {5 \tan ^3(c+d x)}{3 a^2 d}+\frac {4 \tan (c+d x)}{a^2 d}-\frac {\cot (c+d x)}{a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}-\frac {2 \sec ^3(c+d x)}{3 a^2 d}-\frac {2 \sec (c+d x)}{a^2 d}+\frac {2 \tanh ^{-1}(\cos (c+d x))}{a^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 213
Rule 276
Rule 308
Rule 2700
Rule 2702
Rule 2952
Rule 2954
Rule 3852
Rubi steps
\begin {align*} \int \frac {\csc ^2(c+d x) \sec ^2(c+d x)}{(a+a \sin (c+d x))^2} \, dx &=\frac {\int \csc ^2(c+d x) \sec ^6(c+d x) (a-a \sin (c+d x))^2 \, dx}{a^4}\\ &=\frac {\int \left (a^2 \sec ^6(c+d x)-2 a^2 \csc (c+d x) \sec ^6(c+d x)+a^2 \csc ^2(c+d x) \sec ^6(c+d x)\right ) \, dx}{a^4}\\ &=\frac {\int \sec ^6(c+d x) \, dx}{a^2}+\frac {\int \csc ^2(c+d x) \sec ^6(c+d x) \, dx}{a^2}-\frac {2 \int \csc (c+d x) \sec ^6(c+d x) \, dx}{a^2}\\ &=\frac {\text {Subst}\left (\int \frac {\left (1+x^2\right )^3}{x^2} \, dx,x,\tan (c+d x)\right )}{a^2 d}-\frac {\text {Subst}\left (\int \left (1+2 x^2+x^4\right ) \, dx,x,-\tan (c+d x)\right )}{a^2 d}-\frac {2 \text {Subst}\left (\int \frac {x^6}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{a^2 d}\\ &=\frac {\tan (c+d x)}{a^2 d}+\frac {2 \tan ^3(c+d x)}{3 a^2 d}+\frac {\tan ^5(c+d x)}{5 a^2 d}+\frac {\text {Subst}\left (\int \left (3+\frac {1}{x^2}+3 x^2+x^4\right ) \, dx,x,\tan (c+d x)\right )}{a^2 d}-\frac {2 \text {Subst}\left (\int \left (1+x^2+x^4+\frac {1}{-1+x^2}\right ) \, dx,x,\sec (c+d x)\right )}{a^2 d}\\ &=-\frac {\cot (c+d x)}{a^2 d}-\frac {2 \sec (c+d x)}{a^2 d}-\frac {2 \sec ^3(c+d x)}{3 a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}+\frac {4 \tan (c+d x)}{a^2 d}+\frac {5 \tan ^3(c+d x)}{3 a^2 d}+\frac {2 \tan ^5(c+d x)}{5 a^2 d}-\frac {2 \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (c+d x)\right )}{a^2 d}\\ &=\frac {2 \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a^2 d}-\frac {2 \sec (c+d x)}{a^2 d}-\frac {2 \sec ^3(c+d x)}{3 a^2 d}-\frac {2 \sec ^5(c+d x)}{5 a^2 d}+\frac {4 \tan (c+d x)}{a^2 d}+\frac {5 \tan ^3(c+d x)}{3 a^2 d}+\frac {2 \tan ^5(c+d x)}{5 a^2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(289\) vs. \(2(130)=260\).
time = 0.55, size = 289, normalized size = 2.22 \begin {gather*} -\frac {\csc ^3(c+d x) \left (40+48 \cos (2 (c+d x))+112 \cos (3 (c+d x))-28 \cos (4 (c+d x))+60 \cos (3 (c+d x)) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-4 \cos (c+d x) \left (28+15 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-15 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )-60 \cos (3 (c+d x)) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+58 \sin (c+d x)-168 \sin (2 (c+d x))-90 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right ) \sin (2 (c+d x))+90 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (2 (c+d x))+82 \sin (3 (c+d x))+28 \sin (4 (c+d x))+15 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))-15 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right ) \sin (4 (c+d x))\right )}{15 a^2 d \left (\csc ^2\left (\frac {1}{2} (c+d x)\right )-\sec ^2\left (\frac {1}{2} (c+d x)\right )\right ) (1+\sin (c+d x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.32, size = 134, normalized size = 1.03
method | result | size |
derivativedivides | \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {8}{5 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}+\frac {4}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {26}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {9}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}-\frac {31}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {1}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-4 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(134\) |
default | \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {8}{5 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}+\frac {4}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {26}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {9}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}-\frac {31}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {1}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-4 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(134\) |
risch | \(-\frac {4 \left (-85 \,{\mathrm e}^{5 i \left (d x +c \right )}+60 i {\mathrm e}^{6 i \left (d x +c \right )}-40 i {\mathrm e}^{4 i \left (d x +c \right )}+97 \,{\mathrm e}^{i \left (d x +c \right )}-108 i {\mathrm e}^{2 i \left (d x +c \right )}+28 i-27 \,{\mathrm e}^{3 i \left (d x +c \right )}+15 \,{\mathrm e}^{7 i \left (d x +c \right )}\right )}{15 \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )^{5} \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a^{2} d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a^{2} d}\) | \(174\) |
norman | \(\frac {\frac {1}{2 a d}-\frac {55 \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 a d}+\frac {\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}+\frac {7 \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 a d}-\frac {29 \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 a d}+\frac {199 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{30 a d}+\frac {188 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{15 a d}+\frac {7 \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 a d}}{a \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{5}}-\frac {2 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d \,a^{2}}\) | \(201\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 309 vs.
\(2 (122) = 244\).
time = 0.28, size = 309, normalized size = 2.38 \begin {gather*} -\frac {\frac {\frac {244 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {571 \, \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {320 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} - \frac {475 \, \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}} - \frac {660 \, \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}} - \frac {255 \, \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}} + 15}{\frac {a^{2} \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {4 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {5 \, a^{2} \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} - \frac {5 \, a^{2} \sin \left (d x + c\right )^{5}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{5}} - \frac {4 \, a^{2} \sin \left (d x + c\right )^{6}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{6}} - \frac {a^{2} \sin \left (d x + c\right )^{7}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{7}}} + \frac {60 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}} - \frac {15 \, \sin \left (d x + c\right )}{a^{2} {\left (\cos \left (d x + c\right ) + 1\right )}}}{30 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.37, size = 218, normalized size = 1.68 \begin {gather*} -\frac {56 \, \cos \left (d x + c\right )^{4} - 80 \, \cos \left (d x + c\right )^{2} - 15 \, {\left (2 \, \cos \left (d x + c\right )^{3} + {\left (\cos \left (d x + c\right )^{3} - 2 \, \cos \left (d x + c\right )\right )} \sin \left (d x + c\right ) - 2 \, \cos \left (d x + c\right )\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + 15 \, {\left (2 \, \cos \left (d x + c\right )^{3} + {\left (\cos \left (d x + c\right )^{3} - 2 \, \cos \left (d x + c\right )\right )} \sin \left (d x + c\right ) - 2 \, \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 2 \, {\left (41 \, \cos \left (d x + c\right )^{2} - 3\right )} \sin \left (d x + c\right ) + 9}{15 \, {\left (2 \, a^{2} d \cos \left (d x + c\right )^{3} - 2 \, a^{2} d \cos \left (d x + c\right ) + {\left (a^{2} d \cos \left (d x + c\right )^{3} - 2 \, a^{2} d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \frac {\int \frac {\csc ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\sin ^{2}{\left (c + d x \right )} + 2 \sin {\left (c + d x \right )} + 1}\, dx}{a^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.48, size = 161, normalized size = 1.24 \begin {gather*} -\frac {\frac {120 \, \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a^{2}} - \frac {30 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2}} - \frac {15 \, {\left (4 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 7 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )} a^{2}} + \frac {465 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 1590 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2240 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1450 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 383}{a^{2} {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}^{5}}}{60 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 10.78, size = 216, normalized size = 1.66 \begin {gather*} \frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,a^2\,d}-\frac {2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a^2\,d}-\frac {-17\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-44\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5-\frac {95\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{3}+\frac {64\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{3}+\frac {571\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{15}+\frac {244\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{15}+1}{d\,\left (-2\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7-8\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-10\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+10\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+8\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+2\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________